//
//  File.swift
//
//
//  Created by didi on 2022/9/9.
//

import Vapor

struct SystemFinishInstallStepController: SystemInstallStepController {
    func installStep(_ req: Request, info: SystemInstallInfo) async throws -> Response {
        return req.templates.renderHtml(SystemInstallPageTemplate(.init(icon: "🪶",
                                                                        title: "Setup completed",
                                                                        message: "Your site is now ready to use.",
                                                                        link: .init(label: "Let's get start →", path: installPath(req, for: info.currentStep, next: true)))))
    }

    func performInstallStep(_ req: Request, info: SystemInstallInfo) async throws -> Response? {
        req.molecular.installIsComplated = true
        return req.redirect(to: "/")
    }
}
